﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_RptHeHanSuDung : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboDonVi")]
        private ComboBox _CboDonVi;
        [AccessedThroughProperty("CboKhoHang")]
        private ComboBox _CboKhoHang;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("CmdXem")]
        private Button _CmdXem;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label3")]
        private Label _Label3;
        [AccessedThroughProperty("Label4")]
        private Label _Label4;
        [AccessedThroughProperty("Label5")]
        private Label _Label5;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("TxtDenNgay")]
        private DateTimePicker _TxtDenNgay;
        [AccessedThroughProperty("TxtSoNgay")]
        private NumericUpDown _TxtSoNgay;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsNhapKho objPNK;
        private DataTable pData;

        public Frm_RptHeHanSuDung()
        {
            base.Load += new EventHandler(this.Frm_RptNhapXuatTonKho_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objPNK = new clsNhapKho();
            this.InitializeComponent();
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            this.PrintReport();
        }

        private void CmdXem_Click(object sender, EventArgs e)
        {
            this.pData = this.objPNK.GetDataPrintHeHanDung(LVYModule.Date2Char(this.TxtDenNgay.Text), Convert.ToInt32(this.TxtSoNgay.Value), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonVi.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim(), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboKhoHang.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim());
            this.VSlist.Rows.Count = 1;
            int num2 = this.pData.Rows.Count - 1;
            for (int i = 0; i <= num2; i++)
            {
                this.VSlist.AddItem("");
                this.VSlist[this.VSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["Ma"]);
                this.VSlist[this.VSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["TenHang"]);
                this.VSlist[this.VSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["DonViTinh"]);
                this.VSlist[this.VSlist.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoLoHang"]);
                this.VSlist[this.VSlist.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["NgayNhap"]);
                this.VSlist[this.VSlist.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["HanSuDung"]);
                this.VSlist[this.VSlist.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoNgay"]);
                this.VSlist[this.VSlist.Rows.Count - 1, 7] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoLuongTon"]);
                this.VSlist[this.VSlist.Rows.Count - 1, 8] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["TriGiaTon"]);
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_RptNhapXuatTonKho_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                BuildComboModule.BuildCombo(this.CboDonVi, modGeneral.ListDanhMuc.DonVi, true, "", "");
                this.CboDonVi.SelectedValue = modGeneral.H_CLIENT;
                BuildComboModule.BuildCombo(this.CboKhoHang, modGeneral.ListDanhMuc.KhoHang, false, "", "");
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_RptHeHanSuDung));
            this.Panel1 = new Panel();
            this.CmdXem = new Button();
            this.CmdCancel = new Button();
            this.CmdOK = new Button();
            this.CboKhoHang = new ComboBox();
            this.Label2 = new Label();
            this.TxtSoNgay = new NumericUpDown();
            this.Label5 = new Label();
            this.TxtDenNgay = new DateTimePicker();
            this.Label3 = new Label();
            this.Label4 = new Label();
            this.CboDonVi = new ComboBox();
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1.SuspendLayout();
            this.TxtSoNgay.BeginInit();
            this.VSlist.BeginInit();
            this.SuspendLayout();
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.CmdXem);
            this.Panel1.Controls.Add(this.CmdCancel);
            this.Panel1.Controls.Add(this.CmdOK);
            this.Panel1.Controls.Add(this.CboKhoHang);
            this.Panel1.Controls.Add(this.Label2);
            this.Panel1.Controls.Add(this.TxtSoNgay);
            this.Panel1.Controls.Add(this.Label5);
            this.Panel1.Controls.Add(this.TxtDenNgay);
            this.Panel1.Controls.Add(this.Label3);
            this.Panel1.Controls.Add(this.Label4);
            this.Panel1.Controls.Add(this.CboDonVi);
            this.Panel1.Dock = DockStyle.Top;
            Point point = new Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            Size size = new Size(0x37e, 50);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x16;
            this.CmdXem.Image = ACCOUNTING.My.Resources.Resources.view;
            this.CmdXem.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x283, 0x16);
            this.CmdXem.Location = point;
            this.CmdXem.Name = "CmdXem";
            size = new Size(0x4e, 0x18);
            this.CmdXem.Size = size;
            this.CmdXem.TabIndex = 0x41;
            this.CmdXem.Text = "&Xem";
            this.CmdXem.UseVisualStyleBackColor = true;
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x323, 0x16);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            size = new Size(0x4f, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x40;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdOK.Image = ACCOUNTING.My.Resources.Resources.report;
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x2d2, 0x16);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x4e, 0x18);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 0x3f;
            this.CmdOK.Text = "&Trang in";
            this.CmdOK.UseVisualStyleBackColor = true;
            this.CboKhoHang.FormattingEnabled = true;
            point = new Point(0x18a, 0x18);
            this.CboKhoHang.Location = point;
            this.CboKhoHang.Name = "CboKhoHang";
            size = new Size(0xd8, 0x15);
            this.CboKhoHang.Size = size;
            this.CboKhoHang.TabIndex = 0x3e;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            this.Label2.ForeColor = Color.Black;
            point = new Point(0x187, 7);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x35, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x3d;
            this.Label2.Text = "Kho h\x00e0ng";
            point = new Point(0x13d, 0x18);
            this.TxtSoNgay.Location = point;
            decimal num = new decimal(new int[] { 0x1388, 0, 0, 0 });
            this.TxtSoNgay.Maximum = num;
            this.TxtSoNgay.Name = "TxtSoNgay";
            size = new Size(0x47, 20);
            this.TxtSoNgay.Size = size;
            this.TxtSoNgay.TabIndex = 60;
            num = new decimal(new int[] { 30, 0, 0, 0 });
            this.TxtSoNgay.Value = num;
            this.Label5.AutoSize = true;
            this.Label5.BackColor = Color.Transparent;
            this.Label5.ForeColor = Color.Black;
            point = new Point(0x13a, 7);
            this.Label5.Location = point;
            this.Label5.Name = "Label5";
            size = new Size(0x2e, 13);
            this.Label5.Size = size;
            this.Label5.TabIndex = 0x3b;
            this.Label5.Text = "Số ng\x00e0y";
            this.TxtDenNgay.Format = DateTimePickerFormat.Short;
            point = new Point(0xe0, 0x18);
            this.TxtDenNgay.Location = point;
            this.TxtDenNgay.Name = "TxtDenNgay";
            size = new Size(0x57, 20);
            this.TxtDenNgay.Size = size;
            this.TxtDenNgay.TabIndex = 0x3a;
            this.Label3.AutoSize = true;
            this.Label3.BackColor = Color.Transparent;
            this.Label3.ForeColor = Color.Black;
            point = new Point(0xdd, 7);
            this.Label3.Location = point;
            this.Label3.Name = "Label3";
            size = new Size(0x4e, 13);
            this.Label3.Size = size;
            this.Label3.TabIndex = 0x39;
            this.Label3.Text = "T\x00ednh đến ng\x00e0y";
            this.Label4.AutoSize = true;
            this.Label4.BackColor = Color.Transparent;
            this.Label4.ForeColor = Color.Black;
            point = new Point(2, 7);
            this.Label4.Location = point;
            this.Label4.Name = "Label4";
            size = new Size(0x26, 13);
            this.Label4.Size = size;
            this.Label4.TabIndex = 0x38;
            this.Label4.Text = "Đơn vị";
            this.CboDonVi.FormattingEnabled = true;
            point = new Point(3, 0x18);
            this.CboDonVi.Location = point;
            this.CboDonVi.Name = "CboDonVi";
            size = new Size(0xd6, 0x15);
            this.CboDonVi.Size = size;
            this.CboDonVi.TabIndex = 0x37;
            this.VSlist.AllowEditing = false;
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes;
            this.VSlist.ColumnInfo = manager.GetString("VSlist.ColumnInfo");
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.FocusRect = FocusRectEnum.None;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            point = new Point(0, 50);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x37e, 0x206);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 30;
            this.VSlist.VisualStyle = VisualStyle.Office2007Blue;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x37e, 0x238);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.VSlist);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_RptHeHanSuDung";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "KH-BC01";
            this.Text = "HANG HET HAN SU DUNG";
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.TxtSoNgay.EndInit();
            this.VSlist.EndInit();
            this.ResumeLayout(false);
        }

        public void PrintReport()
        {
            if (this.VSlist.Rows.Count != 1)
            {
                this.Cursor = Cursors.WaitCursor;
                if (this.pData.Rows.Count == 0)
                {
                    LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
                }
                else
                {
                    Rpt_HangHetHanSuDung dung = new Rpt_HangHetHanSuDung();
                    try
                    {
                        dung.SetDataSource(this.pData);
                        if (modGeneral.H_LANGUAGE == "VIET")
                        {
                            dung.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                        }
                        else
                        {
                            dung.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                        }
                        dung.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                        dung.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                        dung.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                        dung.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                        dung.SetParameterValue(5, modGeneral.Tranlated("H\x00c0NG HẾT HẠN SỬ DỤNG", ""));
                        dung.SetParameterValue(6, modGeneral.Tranlated("Đến ng\x00e0y", "") + " : " + this.TxtDenNgay.Text);
                        dung.SetParameterValue(7, modGeneral.Tranlated("Số ng\x00e0y hết hạn", "") + " : " + Conversions.ToString(this.TxtSoNgay.Value));
                        dung.SetParameterValue(8, modGeneral.Tranlated("M\x00e3", ""));
                        dung.SetParameterValue(9, modGeneral.Tranlated("T\x00ean", ""));
                        dung.SetParameterValue(10, modGeneral.Tranlated("ĐVT", ""));
                        dung.SetParameterValue(11, modGeneral.Tranlated("Số l\x00f4", ""));
                        dung.SetParameterValue(12, modGeneral.Tranlated("Hạn sử dụng", ""));
                        dung.SetParameterValue(13, modGeneral.Tranlated("C\x00f2n lại", ""));
                        dung.SetParameterValue(14, modGeneral.Tranlated("Số lượng tồn", ""));
                        dung.SetParameterValue(15, modGeneral.Tranlated("Trị gi\x00e1 tồn", ""));
                        dung.SetParameterValue(0x10, modGeneral.Tranlated("Tổng cộng", ""));
                        dung.SetParameterValue(0x11, modGeneral.Tranlated("Ng\x00e0y .... th\x00e1ng .... năm ............", ""));
                        dung.SetParameterValue(0x12, modGeneral.Tranlated("Lập biểu", ""));
                        dung.SetParameterValue(0x13, modGeneral.Tranlated("Kế to\x00e1n trưởng", ""));
                        dung.SetParameterValue(20, modGeneral.Tranlated("Gi\x00e1m đốc", ""));
                        dung.SetParameterValue(0x15, modGeneral.Tranlated("Kho h\x00e0ng", ""));
                        dung.SetParameterValue(0x16, modGeneral.Tranlated("Nh\x00f3m h\x00e0ng", ""));
                        MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = dung;
                        MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                        this.Cursor = Cursors.Default;
                        MyProject.Forms.Frm_ViewReport.ShowDialog();
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        this.Cursor = Cursors.Default;
                        MessageBox.Show(exception.Message.ToString());
                        ProjectData.ClearProjectError();
                    }
                }
            }
        }

        internal virtual ComboBox CboDonVi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboDonVi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboDonVi = value;
            }
        }

        internal virtual ComboBox CboKhoHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboKhoHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboKhoHang = value;
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual Button CmdXem
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdXem;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdXem_Click);
                if (this._CmdXem != null)
                {
                    this._CmdXem.Click -= handler;
                }
                this._CmdXem = value;
                if (this._CmdXem != null)
                {
                    this._CmdXem.Click += handler;
                }
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual Label Label4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label4 = value;
            }
        }

        internal virtual Label Label5
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label5;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label5 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual DateTimePicker TxtDenNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDenNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDenNgay = value;
            }
        }

        internal virtual NumericUpDown TxtSoNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtSoNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtSoNgay = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSlist = value;
            }
        }
    }
}

